package TestClasser;

import static org.junit.Assert.*;


import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import DBLayer.DBProduct;

import ModelLayer.Product;

public class DBProductTest {

	private DBProduct dbObject;
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		dbObject = new DBProduct();
	}

	@After
	public void tearDown() throws Exception {
	}





	@Test
	public void testSearchProductName() 
	{
		System.out.println("Finder et product via name");
		Product prodObject = dbObject.searchProductName("gun replica", false);
		if(prodObject != null)
		{
			System.out.println(prodObject.getItemId());
			System.out.println("");
		}
		else {
			fail("Product not found");
		}
	}

	@Test
	public void testSearchProductId() 
	{
		System.out.println("Finder et product vi ID");
		Product prodObject = dbObject.findProduct(1, false);
		if(prodObject != null)
		{
			System.out.println(prodObject.getPName());
			System.out.println("");
		}
		else {
			fail("Supplier not found");
		}
	}
}